const App = getApp();
const wxParse = require('../../wxParse/wxParse.js')

Page({

  data: {
    // 页面参数
    options: {},
    // 页面元素
    items: {},
    scrollTop: 0,
    detail:{},
    article:'',
    IsGongshui:'有',
    addr:{},
    SYId:'',
    fenList:[
      {value:'2'}
    ],

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    console.log(options)
    this.setData({
      SYId:options.id
    })
  },

  getDetail(e){
    let _this = this
    App._get("GetShiYaoProjectInfo",{id:e,userId:wx.getStorageSync('user_id')?wx.getStorageSync('user_id'):''},(res)=>{
      console.log(res)
      _this.setData({
        detail:res
      })
      wxParse.wxParse('article','html',res.YaoQiu,_this,0)
    })
  },
  radioChange(e) {
    console.log('，携带value值为：', e.detail.value)
  },
  selectAddress(){
   App.getPermission(this)
  },
  formSubmit(e){
    let data = {...e.detail.value}
    console.log(data)
    // for(let i in data){
    //   if(data[i] === ''){
    //     wx.showToast({
    //       title: '有选项未填写',
    //     })
    //     return
    //   }
    // }
    // data.SYId = this.data.SYId
    App._post_form('SaveShuiChangXunCha',data,(res)=>{
      console.log(res)
      wx.showModal({
        title:res,
        showCancel:false,
        complete:()=>{
          wx.navigateBack()
        }
      })
    })
  },

  /**
   * 分享当前页面
   */
  onShareAppMessage() {
    let _this = this;
    return {
      title: _this.data.detail.Name,
      path: `/pages/detail/index?id=${_this.data.detail.CategaryId}`,
    };
  },
  /**
   * 下拉刷新
   */
  onPullDownRefresh: function() {
    // 获取首页数据
    wx.stopPullDownRefresh();
  }
});